<div class="container-fluid" style="padding: 20px 10px 0px 10px">
	<div class="row-fluid">
		<div class="well">
		    <ul class="nav nav-tabs">
		      <li class="active"><b>添加退货地址</b></li>
		    </ul>
		    <div id="myTabContent" class="tab-content">
				<div class="tab-pane active in" id="home">
					<form id="formid" action="/index.php/readdres/addset" method="post">
						<p>收货人：&nbsp;&nbsp;&nbsp;<input type="text" value="" placeholder="" style="" name="receiver[]" type='text' class="checkname"></p>
						<p>联系电话：<input type="text" value="" placeholder="" style="" name="phone[]" type='text' class="phone"></p>
						<p>退货地址:<textarea style="width:425px;height:55px;margin-left:70px;margin-top: -17px;" name="address[]" placeholder="" class="address"></textarea></p>
						 <ul class="nav nav-tabs"></ul>
						<button id="addattr"  type="button" >+</button>
						<input type="hidden" value="1" name="dosubmit" />
					</form>
				</div>
				<div class="btn-toolbar">
				    <button class="btn btn-primary" id="btn-save" style="margin-left:72px"><i class="icon-save"></i> 保存</button>
				  <div class="btn-group">
				  </div>
				</div>
			</div>
		</div>
	</div>
</div>
<script>
$(function(){
    //添加按钮
	$('#addattr').on('click',function(){
		$(this).before('<span>收货人：&nbsp;&nbsp;&nbsp;<input type="text" name="receiver[]"><br /><br />联系电话：<input type="text" name="phone[]"><br /><br />退货地址:<textarea style="width:425px;height:55px;margin-left:70px;" name="address[]" placeholder="" class="address"></textarea><a class="remove" href="javascript:void(0);"><i style="color:red;" class="icon-remove"></i></a><br /><br /> <ul class="nav nav-tabs"></ul></span>');
	});
    //删除按钮
	$('div').on('click','a[class=remove]',function(){
	$(this).parent('span').remove();
	$(this).next().remove();
	$(this).next().remove();
	$(this).remove();
	});
	$('#btn-save').click(function(){
	    var reg = /^0?1[3|4|5|8][0-9]\d{8}$/;
		if(!($('.checkname').val())){
			showmsg('收货人不能为空');
			return false;	
		}else if(!($('.phone').val())){
		    showmsg('联系电话不能为空');
			return false;	
		}else if(!reg.test($('.phone').val())){
		    showmsg('手机号格式错误');
		return false;	
		}
		else if(!($('.address').val())){
		    showmsg('收获地址不能为空');
			return false;	
		}
		else{
			setBtn($('#btn-save'));
			$('#formid').submit();
		}
		
	});

	
})
</script>